﻿using System;
using System.Collections.Generic;

/// <summary>
/// 格子内朝向，只有左右2个方向
/// </summary>
public enum WarSceneBlockDirction
{
    /// <summary>
    /// 左
    /// </summary>
    LEFT = 0,
    /// <summary>
    /// 右
    /// </summary>
    RIGHT
}

/// <summary>
/// Block可以同时存在元素类型
/// </summary>
public enum WarSceneObjectType
{
    /// <summary>
    /// 陆地元素
    /// </summary>
    LAND = 0,
    /// <summary>
    /// 飞行元素
    /// </summary>
    AIR,
    COUNT
}

public class WarSceneBlock
{
    public void addOject(WarSceneObject wObject)
    {
        if (canMoveIn(wObject.BlockType) == false)
        {
            return;
        }

        mObjects[(int)wObject.BlockType] = wObject;
    }

    public void removeObject(WarSceneObject wObject)
    {
        if (canMoveIn(wObject.BlockType) == false || mObjects[(int)wObject.BlockType] != wObject)
        {
            return;
        }

        mObjects[(int)wObject.BlockType] = null;
    }

    public bool canMoveIn(WarSceneObjectType oType)
    {
        return mObjects[(int)oType] == null;
    }

    #region 属性成员
    public WarSceneObject[] Objects { get { return mObjects; } }
    #endregion

    #region 数据成员
    WarSceneObject[] mObjects = new WarSceneObject[(int)WarSceneObjectType.COUNT];
    #endregion

    #region 委托
    public OnAddObject EOnAddObject = null;

    public delegate void OnAddObject(WarSceneObject wObject);
    #endregion
}
